# -*- coding: utf-8 -*-
# @description: 
# @File  : client.py
# @Time  :2020-03-21 10:35:46
# @Author:selfeasy
import json
from werkzeug.wrappers import Request,Response
def app(env, start_response):
    request = Request(env)
    resp = Response('hello werkzeug from ' + str(request.environ))
    return resp(env, start_response)

@Request.application
def app1(req):
    '''装饰器'''
    print(app1.__doc__)
    print(req)
    return Response('hello werkzeug from '+ str(req.environ['HTTP_USER_AGENT']))


@Request.application
def app2(request):
    data1 = request.args
    # data1 = request.data
    print(data1.lists())
    data = json.dumps(data1)
    print (data, type(data))
    # print request.url
    # print request.base_url
    # print json.loads(data),type(json.loads(data))
    return Response('hello werkzeug from '+ str(data))

@Request.application
def app3(request):
    # data1 = request.get_data()
    print (request.headers)
    data1 = request.data
    # data = json.loads(data1)
    print (data1, type(data1))
    return Response('hello werkzeug from '+ str(data1))